<%@page contentType="text/html; charset=UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>工程订单申请</title>
<%@ include file="../common/common.jsp"%>
<script type="text/javascript">
var basePath=<%=request.getContextPath()+"/"%>;

$.extend($.fn.datagrid.defaults.editors, {  
	text:{
		init: function(container, options){  
			var input = $('<input type="text" class="datagrid-editable-input">').appendTo(container);  
			 return input;  
		},
        getValue: function(target){ 
        	$(target).val(value);  
        },
        resize: function(target, width){  
        	 var input = $(target);  
        	 if ($.boxModel == true){  
        		 input.width(width - (input.outerWidth() - input.width()));  
        	 }else{
        		 input.width(width);  
        	 }
        }
	}
});
$(function(){
    var height = window.document.body.offsetHeight-50;
	$('#order_info').datagrid({ 
		height:height,
		fitColumns:true,
		//fit:true,
		pagination:true,//分页数据
		rownumbers: true,
		loadMsg:'正在加载数据,请稍后',
		pageSize:10,
		url:'datagrid_order.json',
		toolbar:[{text:"生成订单",iconCls:"icon-add",handler:function(){
			//alert('新增');
			$('#win').window('open');
			
		}},{text:"订单申请",iconCls:"icon-edit",handler:function(){
			$('#win').window('open');
		}}],
		editors:{
		},
		columns:[[ 
		          {field:'NO',title:'<input type="checkbox"></input>',width:30,
		        	  formatter:function(value,row,index){ 
		        		  var input = '<input type="checkbox"></input>';
						  return input;  
		              }
		          },
		          {field:'CONTRACTNAME',title:'合同项目名称',width:150},  
		          {field:'CONTRACTEXPTIME',title:'预计施工时间',width:100},  
		          {field:'CONTRACTCHARGE',title:'联系人',width:100},  
		          {field:'CONTRACTTEL',title:'联系方式',width:100},  
		          {field:'CONTRACTADDR',title:'项目地址',width:200},
		          {field:'CONTRACTDETAIL',title:'订单查看',width:200,
		        	  formatter:function(value,row,index){ 
		        		  var input = '<a href="#" onclick="editrow('+index+')">查看订单</a>';
						  return input;  
		              }
		          },
		          {field:'CONTRACTCOUNT',title:'订单数量',width:200,
			          // editor:'text',
			          formatter:function(value,row,index){ 
			        	  var input = '<input type="text" class="datagrid-editable-input">';
						  return input;  
			  	      }
		          }
	    ]],
	    onClickRow:function(rowIndex, rowData){
		},
	    onClickCell:function(a,b,c){
	    	if(b=="CONTRACTCOUNT"){
	    	}
	    }
	});
	
	 $('#win').window({  
		 closable:true,
		 modal:true  
	 });
	// 新增页面
	$('#app').click(function(){
		  //$.messager.confirm('信息提示','你是否要删除当前选中数据?',function(r){  
			  
		  //});
		$('#win').window('open');
	});
	
	$('#add_close').click(function(){
		$('#win').window('close');
	});
});
</script>
</head>
<body class="easyui-layout">
<div id="win"  class="easyui-dialog" title="新增订单信息" closed="true" minimizable="false"
 maximizable="false" collapsible="false" style="width:650px;height:400px;padding:5px;" href=order_form.jsp>
    <form> 

    </form> 
</div>
 
   <div region="center"  title="工程订单申请" closable="false" >
        <table id="order_info"></table>  
  </div>
</body>
</html>